﻿@{
    ViewBag.Title = "Search";
}
@model StarcraftDemo4Site.Models.Searchq
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@{ var answer = ViewData["search_answer"] as StarcraftDemo4Site.Models.Searcha;
   int counter = 0;
}
@if (answer == null)
{
    <h2>search</h2>
    using (Html.BeginForm())
    {
        string[] searchprop = new string[12] { "marine_lower", "marine_upper", "marauder_lower","marauder_upper" , "gas_lower","gas_upper" ,"mineral_lower", "mineral_upper", "barracks_lower", "barracks_upper", "supplyd_lower", "supplyd_upper"};
        string[] searchvals = new string[12] { "0", "100", "0", "100", "0", "10000", "0", "10000", "0", "20", "0", "20" };
    <table id="searchtbl">
        
            @for (int i = 0; i < 12; i = i + 2)
            {
                <tr>
                <td class="fromto">
                    from
                </td>
                <td>
                    <div class="editor-label">
                        @Html.Label(searchprop[i])
                    </div>
                    <input class="text-box single-line valid" id=@searchprop[i] name=@searchprop[i] type="text" value=@searchvals[i] />
                </td>
                <td class="fromto">
                    to
                </td>
                <td>
                    <div class="editor-label">
                        @Html.Label(searchprop[i + 1])
                    </div>
                    <input class="text-box single-line valid" id=@searchprop[i + 1] name=@searchprop[i + 1] type="text" value=@searchvals[i+1] />
                </td>
                </tr>
            }
        
    </table>
    <p>
        <input type="submit" value="Save" />
    </p>
    }
}
@if (answer != null)
{
    <h2>@answer.message</h2>
    foreach (Result r in @answer.list_of_results)
    {
        counter++;
        if (counter < 5)
        {
    <div class="display-field">
        @Html.ActionLink(r.GameId.ToString(), "Details", new { id = r.GameId })
    </div>
        }

    }
}
